package metier.Service;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

import metier.entities.Industrie;
import metier.sess.IIndustrieLocal;


@Stateless
@WebService
public class IndustrieService {
	
	@EJB(beanName="Industrie")
	private IIndustrieLocal metier;
	
	
	@WebMethod
	public void addIndustrie(@WebParam(name="Intitule")String Initule,@WebParam(name="Statut")boolean statut)
	{
		Industrie ct=new Industrie(Initule,statut);
		metier.addIndustrie(ct);
	}
	
	@WebMethod
	public List<Industrie> listIndustrie()
	{
		return metier.getAllIndustrie();
	}
	
	@WebMethod 
	public Industrie getIndustrie(@WebParam(name="Id")Integer Id)
	{
		return metier.getIndustrie(Id);
	}
	
	
	@WebMethod
	public void UpdateIndustrie(@WebParam(name="Id")Integer Id,@WebParam(name="Intitule")String Intitule,@WebParam(name="Statut")boolean statut)
	{
	
		Industrie in=metier.getIndustrie(Id);
		in.setIntitule(Intitule);
		in.setStatut(statut);
		metier.updateIndustrie(in);
		
	}
	
	
	@WebMethod
	public void DeleteIndustrie(@WebParam(name="Id")Integer Id)
	{
		metier.deleteIndustrie(Id);
	}

}
